﻿using Common.EF;
using Common.Infrastructure;
using Common.Infrastructure.Utilities;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Common.AspNetCore
{
    public class MigrationContext : CommonContext, ICommonMigrateContext
    {
        public MigrationContext()
           : base()
        {
        }

        public MigrationContext(IServiceProvider provider, CommonContextParam contextParam)
            : base(provider, contextParam)
        {
        }

        public async Task DatabaseMigrateAsync(IServiceProvider provider, CommonContextParam param)
        {
            using(var context=new MigrationContext(provider, param))
            {
                await context.Database.MigrateAsync();
            } 
        }
    }
}
